package brands

import (
	"context"
	"device_srv/device"
	"device_srv/internal/dao"
	"device_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type BrandsDetailLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewBrandsDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BrandsDetailLogic {
	return &BrandsDetailLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// BrandsDetail 获取品牌信息详情
func (l *BrandsDetailLogic) BrandsDetail(in *device.BrandsDetailRequest) (*device.BrandsDetailResponse, error) {
	//调用业务逻辑
	detail, err := dao.BrandsDetail(in)
	if err != nil {
		return nil, err
	}
	return &device.BrandsDetailResponse{
		Id:               int64(detail.Id),
		BrandName:        detail.BrandName,
		BrandDescription: detail.BrandDescription,
	}, nil
}
